﻿using System;
using System.Linq;
using Illinois.UI.Models;
using NUnit.Framework;

namespace Illinois.UI.Test.Models
{
  [TestFixture]
  public class Given_A_BurnDownViewModel
  {
    private BurnDownViewModel _viewModel;

    [SetUp]
    public void Init()
    {
      const string title = "SPRINT TEST";
      var start = new DateTime(2012, 10, 1);
      var end = new DateTime(2012, 10, 12);
      const int points = 33;
      _viewModel = new BurnDownViewModel(title, start, end, points);
    }

    [Test]
    public void When_Calling_The_MakeLabels_Method_Then_The_Property_Labels_Has_Elements()
    {
      _viewModel.MakeLabels();
      Assert.NotNull(_viewModel.Labels.Count());
    }

    [Test]
    public void When_Calling_The_MakeLabels_Method_Then_The_1st_Element_Of_The_Property_Labels_Is_0110()
    {
      _viewModel.MakeLabels();
      Assert.AreEqual("01/10", _viewModel.Labels[0]);
    }

    [Test]
    public void When_Calling_The_MakeLabels_Method_Then_The_2nd_Element_Of_The_Property_Labels_Is_0210()
    {
      _viewModel.MakeLabels();
      Assert.AreEqual("02/10", _viewModel.Labels[1]);
    }

    [Test]
    public void When_Calling_The_MakeLabels_Method_Then_The_Last_Element_Of_The_Property_Labels_Is_1210()
    {
      _viewModel.MakeLabels();
      Assert.AreEqual("12/10", _viewModel.Labels[_viewModel.Labels.Count() - 1]);
    }

    [Test]
    public void When_Calling_The_MakeLabels_Method_Then_The_6th_Element_Of_The_Property_Labels_Is_0810()
    {
      _viewModel.MakeLabels();
      Assert.AreEqual("08/10", _viewModel.Labels[5]);
    }
  }
}
